package com.honey.generator.java;

import org.java.plugin.Plugin;

import com.honey.generator.java.extension.point.GeneratorJavaClass;

/**
 * 
 * @author Administrator
 *
 */
public class GeneratorJavaClassExtension extends AbstractGenerator{
	
	private GeneratorJavaClassPlugin generatorJavaClassPlugin  = null;
	
	public GeneratorJavaClassExtension(Plugin belongPlugin) {
		super(belongPlugin);
		generatorJavaClassPlugin = (GeneratorJavaClassPlugin)belongPlugin;
	}
	@Override
	public GeneratorJavaClass[] getGeneratorJavaClass() {
		GeneratorJavaClass[] answer = null;
		try{
			answer  =generatorJavaClassPlugin.getGeneratorJavaClass() ;
		}catch(Exception e){
			e.printStackTrace();
		}
		return answer ;
	}

	@Override
	public GeneratorJavaClassPlugin getGeneratorJavaClassPlugin() {
		
		return generatorJavaClassPlugin;
	}
//	@Override
//	public CompilationDescriptor[] compilation(IntrospectSchema introspectSchema, IntrospectSchemaColumn introspectSchemaColumn) {
//		CompilationDescriptor[] answer = null;
//		try {
//			String workespace = generatorJavaClassPlugin.getTargetSrcDirectory() ;
//			StorageType storageType = generatorJavaClassPlugin.getStorageType();
//			
//			GeneratorJavaClass[] generatorJavaClasses = generatorJavaClassPlugin.getGeneratorJavaClass() ;
//			answer = new CompilationDescriptor[generatorJavaClasses.length];
//			int i = 0;
//			AbstractJavaCompilation abstractJavaCompilation =  null;
//			for(GeneratorJavaClass generatorJavaClass : generatorJavaClasses ){
//				abstractJavaCompilation = CompilationFactory.doJavaCompilation(generatorJavaClassPlugin , generatorJavaClass, introspectSchema, introspectSchemaColumn);
//				if( abstractJavaCompilation != null ){
//					answer[i] = new CompilationDescriptor(
//						abstractJavaCompilation, 
//						workespace, 
//						CompilationType.JAVA, 
//						storageType,
//						generatorJavaClass.getContentType(), 
//						generatorJavaClassPlugin.getCharset()
//					);
//				}
//				i++;
//			}
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//		return answer;
//	}
	
	@Override
	public void clean() {
		
	}

	
}
